package com.tuyue.police.util;

import com.alibaba.fastjson.JSON;
import org.springframework.util.ObjectUtils;

/**
 * @Author: 王金海
 * @Description:
 * @Date: Created by Administrator on 2018/4/9.
 * @Modified By:
 */
public class JsonToObject{

    public static Result parseObject(String json, Class c) {
        Result result = JSON.parseObject(json, Result.class);

        if (!ObjectUtils.isEmpty(result.getData())) {
            String data =result.getData().toString();
            Object o= JSON.parseObject(data, c);
            result.setData(o);
        }
        return result;
    }

    public static Result parseObject(String json) {
        return JSON.parseObject(json, Result.class);
    }

}
